package org.example.myleet.p641;

import org.example.myleet.Utils.Assert;

public class Main {
    public static void main(String[] args) {
        //example 1
        MyCircularDeque deque = new MyCircularDeque(3);
        Assert.isTrue(deque.insertLast(1));
        Assert.isTrue(deque.insertLast(2));
        Assert.isTrue(deque.insertFront(3));
        Assert.isTrue(!deque.insertFront(4));
        Assert.isTrue(2 == deque.getRear());
        Assert.isTrue(deque.isFull());
        Assert.isTrue(deque.deleteLast());
        Assert.isTrue(deque.insertFront(4));
        Assert.isTrue(4 == deque.getFront());
        Assert.isTrue(deque.deleteFront());
        Assert.isTrue(deque.deleteFront());
        Assert.isTrue(deque.deleteFront());
        Assert.isTrue(!deque.deleteFront());
        Assert.isTrue(-1 == deque.getFront());
        Assert.isTrue(-1 == deque.getRear());

        //example 2
        MyCircularDeque deque2 = new MyCircularDeque(4);
        Assert.isTrue(deque2.insertFront(9));
        Assert.isTrue(deque2.deleteLast());
        Assert.isTrue(-1 == deque2.getRear());
        Assert.isTrue(-1 == deque2.getFront());
        Assert.isTrue(-1 == deque2.getFront());
        Assert.isTrue(!deque2.deleteFront());
        Assert.isTrue(deque2.insertFront(6));
        Assert.isTrue(deque2.insertLast(5));
        Assert.isTrue(deque2.insertFront(9));
        Assert.isTrue(9 == deque2.getFront());
        Assert.isTrue(deque2.insertFront(6));
    }
}
